home *** CD-ROM | disk | FTP | other *** search
- HUGECALC
-
-
- Neil Rubenking September 24, 1991 (Utilities)
-
-
- Purpose: A command-line calculator utility that can perform addition,
- subtraction, multiplication, division, exponentiation, and factorial functions
- on numbers with up to 254 significant digits.
-
- Format: HC n operator [n]
-
- Remarks: The n operand variables may consist of any string of digits up to
- the 127-character maximum of the DOS command line. The operands must not
- include commas or other formatting punctuation, and must be separated from the
- command and the operator by at least one space. Two operands are required for
- all operations except factorial. The operators recognized are +, -, *, /, ^,
- and !.
-
- When output to the screen (the default) or redirected to a printer or
- other DOS device, HUGECALC prints the name of the function and inserts commas
- at every three digits in the numeric result. If the output is redirected to a
- file or piped to a program input, however, only the numeric result is sent.
- Note that when it accepts input from a file or via a pipe, HUGECALC uses that
- input as its first operand.
-
- Example: If a program that prints 10,000 permutations a second is asked to
- print all possible combinations of 13 characters, how long will it take? The
- command
-
- HC 13 ! | HC / 10000 | HC / 3600 | HC / 24
-
- pipes the factorial of 13 (the possible combinations) to a second
- instance of HC, which divides it by 10,000 (the permutations per second). The
- result is piped to a third instance of HC, which divides it by 3600 (the
- seconds in an hour), and finally to a fourth instance of HC, which divides it
- by 24 (the hours in a day). The answer printed on the screen is:
-
- QUOTIENT: 7
- REMAINDER: 4,
-
- that is, 7 days, 4 hours.
-
- Note that all such chained calculations must be strictly sequential
- and that parenthetical expressions are not supported.